{% if section.settings.collection.id %}
  {% get_collection collections_id={section.settings.collection.id} %}
  {% assign collection = collection  %}
{% endif %}
{% assign data = section.settings %}
<div class="container_wrapper block_collection_list" style="--text-algin: {{data.text_algin}}">
	{% if data.more != ""%}
		{% assign more_href = '/collections/' | append: collection.handle | append: '?data_from=' | append: data_from  %}
	{% endif %}
	{% include 'title',title: data.block_title,detail: data.block_detail,class: 'title_line',more_text: data.more, more_href: more_href %}
  <div class="collection_product" style="--pc_number:{{section.settings.pc_number}};--wap_number:{{section.settings.wap_number}}">
    {% get_products collection_id={section.settings.collection.id} limit={ section.settings.product_number } %}
    {%- if products.size > 0 -%}
      {% for product in products %}
        {% include 'collection_product',product:product, collection_handle:collection.handle %}
      {% endfor %}
    {%- else -%}
      {%- for i in (1..8) -%}
        {% include "collection_product" %}
      {%- endfor -%}
    {%- endif -%}
  </div>
</div>
{% schema %}
{
	"tag": "",
	"class": "block_collection_list",
	"icon": "icon-zhuanjishangpin",
	"is_global": false,
	"name": {
		"zh_CN": "专辑商品",
		"en_US": "Collection"
	},
	"max_blocks": "",
	"settings": [
		{
			"type": "card_header",
			"label": {
				"zh_CN": "设置",
				"en_US": "Settings"
			}
		},
		{
			"type": "card_collection",
			"label": {
				"zh_CN": "选择专辑",
				"en_US": "Select collection"
			},
			"default": {
				"id": "",
				"title": ""
			},
			"id": "collection"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "标题",
				"en_US": "Title"
			},
			"id": "block_title",
			"default": "HEELED SANDALS"
		},
		{
			"type": "card_text_editor",
			"label": {
				"zh_CN": "简短描述",
				"en_US": "Short description"
			},
			"id": "block_detail",
			"default": "bottom_center"
		},
		{
			"type": "card_input_number",
			"label": {
				"zh_CN": "产品总数量",
				"en_US": "Total quantity of products"
			},
			"max": 1000,
			"min": 1,
			"id": "product_number",
			"default": 8
		},
		{
			"type": "card_slider",
			"label": {
				"zh_CN": "PC每排数量",
				"en_US": "PC number per row"
			},
			"id": "pc_number",
			"max": "5",
			"min": "3",
			"default": "4"
		},
		{
			"type": "card_slider",
			"label": {
				"zh_CN": "移动端每排数量",
				"en_US": "Number of mobile terminals per row"
			},
			"id": "wap_number",
			"max": "2",
			"min": "1"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "查看更多",
				"en_US": "See more"
			},
			"id": "more",
			"default": "VIEW MORE"
		}
	],
	"blocks": [],
	"default": {
		"settings": {
			"collection": {
				"id": "",
				"title": ""
			},
			"block_title": "HEELED SANDALS",
			"block_detail": "",
			"product_number": "8",
			"pc_number": "4",
			"wap_number": "2",
			"more": "VIEW MORE"
		},
		"blocks": []
	}
}
{% endschema %}